

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Numeric Component &mdash; MNMLSTC Core 1.1 documentation</title>
  

  
  

  
  <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  
    <link rel="top" title="MNMLSTC Core 1.1 documentation" href="index.html"/>
        <link rel="next" title="Variant Component" href="variant.html"/>
        <link rel="prev" title="Optional Component" href="optional.html"/> 

  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-nav-search">
        <a href="index.html" class="fa fa-home"> MNMLSTC Core</a>
        <div role="search">
  <form id ="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
        
        
            <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="usage.html">Using MNMLSTC Core</a><ul>
<li class="toctree-l2"><a class="reference internal" href="usage.html#library-layout">Library Layout</a></li>
<li class="toctree-l2"><a class="reference internal" href="usage.html#feature-addition-and-deprecation">Feature Addition and Deprecation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="type-traits.html">Type Traits</a></li>
<li class="toctree-l1"><a class="reference internal" href="functional.html">Functional Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="algorithm.html">Algorithms</a><ul>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#non-modifying-sequence-operations">Non-Modifying Sequence Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#modifying-sequence-operations">Modifying Sequence Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#partitioning-operations">Partitioning Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#sorting-operations">Sorting Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#binary-search-operations">Binary Search Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#set-operations">Set Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#heap-operations">Heap Operations</a></li>
<li class="toctree-l2"><a class="reference internal" href="algorithm.html#min-max-operations">Min/Max Operations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="iterator.html">Iterator Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="optional.html">Optional Types</a><ul>
<li class="toctree-l2"><a class="reference internal" href="optional.html#optional-type">Optional Type</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#expected-type">Expected Type</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#result-type">Result Type</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#functions">Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="optional.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Numeric Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="variant.html">Variant Type</a><ul>
<li class="toctree-l2"><a class="reference internal" href="variant.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="utility.html">Uncategorized Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="memory.html">Memory</a><ul>
<li class="toctree-l2"><a class="reference internal" href="memory.html#polymorphic-smart-pointer">Polymorphic Smart Pointer</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#deep-copying-smart-pointer">Deep Copying Smart Pointer</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#dumbest-smart-pointer">Dumbest Smart Pointer</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#utilities">Utilities</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#comparison-operators">Comparison Operators</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#make-functions">Make Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="memory.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="string.html">String Utilities</a><ul>
<li class="toctree-l2"><a class="reference internal" href="string.html#specializations">Specializations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="range.html">Range Type</a><ul>
<li class="toctree-l2"><a class="reference internal" href="range.html#specialization">Specialization</a></li>
<li class="toctree-l2"><a class="reference internal" href="range.html#answers-to-open-questions">Answers to Open Questions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="any.html">Any Type</a></li>
</ul>

        
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="index.html">MNMLSTC Core</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="index.html">Docs</a> &raquo;</li>
      
    <li>Numeric Component</li>
      <li class="wy-breadcrumbs-aside">
        
          <a href="_sources/numeric.txt" rel="nofollow"> View page source</a>
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main">
            
  <div class="section" id="numeric-component">
<span id="core-numeric-component"></span><h1>Numeric Component<a class="headerlink" href="#numeric-component" title="Permalink to this headline">¶</a></h1>
<p>The numeric component is a wrapper around the C++ stdlib <tt class="docutils literal"><span class="pre">&lt;numeric&gt;</span></tt> header.
The functions contained within this header take a range of values. However,
as is common in the C++ standard library, it requires the user to provide a
begin and end to the range of elements. Because MNMLSTC Core provides a
<a class="reference internal" href="range.html#range:T:" title="range&lt;T&gt;"><tt class="xref cpp cpp-class docutils literal"><span class="pre">range</span></tt></a> type, there is no logical reason a version of these
functions that take a range are not provided.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Several functions in this component take a range as its input, and
an output iterator for output. These functions <em>do not</em> change the output
to also be a range. An iterator <em>must</em> be passed to them (This reduces the
number of overloads needed while also allowing the continued use of
<tt class="docutils literal"><span class="pre">back_insert_iterator</span></tt> and friends.</p>
</div>
<dl class="function">
<dt id="iota__RangeRR.TRR">
void <tt class="descname">iota</tt><big>(</big>Range&amp;&amp; <em>range</em>, T&amp;&amp; <em>value</em><big>)</big><a class="headerlink" href="#iota__RangeRR.TRR" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Requires:</th><td class="field-body"><em>range</em> must provide ForwardIterators</td>
</tr>
</tbody>
</table>
<p>Fills <em>range</em> with sequentially increasing values, starting with <em>value</em>.
While <em>range</em> is treated as a universal reference, its lifetime should
extend past that of the call to <a class="reference internal" href="#iota__RangeRR.TRR" title="iota"><tt class="xref cpp cpp-func docutils literal"><span class="pre">iota()</span></tt></a>, in the event that <em>range</em>
is an rvalue reference. The <em>value</em> is simply perfectly forwarded to the
underlying <tt class="docutils literal"><span class="pre">std::iota</span></tt> call.</p>
</dd></dl>

<dl class="function">
<dt id="accumulate__RangeRR.TRR">
decay_t&lt;T&gt; <tt class="descname">accumulate</tt><big>(</big>Range&amp;&amp; <em>range</em>, T&amp;&amp; <em>init</em><big>)</big><a class="headerlink" href="#accumulate__RangeRR.TRR" title="Permalink to this definition">¶</a></dt>
<dt id="accumulate__RangeRR.X.BinaryOpRR">
decay_t&lt;T&gt; <tt class="descname">accumulate</tt><big>(</big>Range&amp;&amp; <em>range</em>, <em>T&amp;&amp;</em>, BinaryOp&amp;&amp; <em>op</em><big>)</big><a class="headerlink" href="#accumulate__RangeRR.X.BinaryOpRR" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the sum of the given value <em>init</em> and the elements in <em>range</em>. The
first version uses <tt class="docutils literal"><span class="pre">operator</span> <span class="pre">+</span></tt>, while the second version uses <em>op</em>.
Both <em>init</em> and <em>op</em> are perfectly forwarded. The lifetime of <em>range</em> may
end with the call to this function.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Requires:</th><td class="field-body"><em>range</em> must provide InputIterators.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="inner_product__RangeRR.InputItRR.TRR">
decay_t&lt;T&gt; <tt class="descname">inner_product</tt><big>(</big>Range&amp;&amp; <em>range</em>, InputIt&amp;&amp; <em>it</em>, T&amp;&amp; <em>value</em><big>)</big><a class="headerlink" href="#inner_product__RangeRR.InputItRR.TRR" title="Permalink to this definition">¶</a></dt>
<dt id="inner_product__RangeRR.InputItRR.TRR.BinaryOpRR.BinaryOp2RR">
decay_t&lt;T&gt; <tt class="descname">inner_product</tt><big>(</big>Range&amp;&amp; <em>range</em>, InputIt&amp;&amp; <em>it</em>, T&amp;&amp; <em>value</em>, BinaryOp&amp;&amp; <em>op</em>, BinaryOp2&amp;&amp; <em>op2</em><big>)</big><a class="headerlink" href="#inner_product__RangeRR.InputItRR.TRR.BinaryOpRR.BinaryOp2RR" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the inner product (that is, the sum of products of the element in
<em>range</em>. The first version uses <tt class="docutils literal"><span class="pre">operator</span> <span class="pre">*</span></tt> to compute the product of
element pairs and <tt class="docutils literal"><span class="pre">operator</span> <span class="pre">+</span></tt> to sum the products. The second version
uses <em>op</em> and <em>op2</em> for these tasks respectively.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Requires:</th><td class="field-body"><em>range</em> must provide InputIterators</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="adjacent_difference__RangeRR.OutputItRR">
decay_t&lt;OutputIt&gt; <tt class="descname">adjacent_difference</tt><big>(</big>Range&amp;&amp; <em>range</em>, OutputIt&amp;&amp; <em>it</em><big>)</big><a class="headerlink" href="#adjacent_difference__RangeRR.OutputItRR" title="Permalink to this definition">¶</a></dt>
<dt id="adjacent_difference__RangeRR.OutputItRR.BinaryOpRR">
decay_t&lt;OutputIt&gt; <tt class="descname">adjacent_difference</tt><big>(</big>Range&amp;&amp; <em>range</em>, OutputIt&amp;&amp; <em>it</em>, BinaryOp&amp;&amp; <em>op</em><big>)</big><a class="headerlink" href="#adjacent_difference__RangeRR.OutputItRR.BinaryOpRR" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the differences between the second and the first of each adjacent
pair of elements in <em>range</em>, and writes them to the range beginning at
<em>it</em> + 1. The first version uses <tt class="docutils literal"><span class="pre">operator</span> <span class="pre">-</span></tt>, while the second uses
<em>op</em>. These parameters are perfectly forwarded to the underlying call to
<tt class="docutils literal"><span class="pre">std::adjacent_difference</span></tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Requires:</th><td class="field-body"><em>range</em> must provide InputIterators.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="partial_sum__RangeRR.OutputItRR">
decay_t&lt;OutputIt&gt; <tt class="descname">partial_sum</tt><big>(</big>Range&amp;&amp; <em>range</em>, OutputIt&amp;&amp; <em>it</em><big>)</big><a class="headerlink" href="#partial_sum__RangeRR.OutputItRR" title="Permalink to this definition">¶</a></dt>
<dt id="partial_sum__RangeRR.OutputItRR.BinaryOpRR">
decay_t&lt;OutputIt&gt; <tt class="descname">partial_sum</tt><big>(</big>Range&amp;&amp; <em>range</em>, OutputIt&amp;&amp; <em>it</em>, BinaryOp&amp;&amp; <em>op</em><big>)</big><a class="headerlink" href="#partial_sum__RangeRR.OutputItRR.BinaryOpRR" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div>Computes the partial sum of the slemenets in the subranges of <em>range</em>.
It then writes these values to the range beginning at <em>it</em>. The first
version uses <tt class="docutils literal"><span class="pre">operator</span> <span class="pre">+</span></tt>, while the second uses the binary operation
<em>op</em>.</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Requires:</th><td class="field-body"><em>range</em> must provide InputIterators.</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>


          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="variant.html" class="btn btn-neutral float-right" title="Variant Component"/>Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="optional.html" class="btn btn-neutral" title="Optional Component"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2013 - 2014, MNMLSTC.
    </p>
  </div>

  <a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
</footer>
        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'1.1',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>